import Http, {HttpParamsProps, ReqProps} from "@/common/http";
import {BaseEntity} from "@/common/httptypes";


export type SysAdminEntity = {
    adminCode: string
    adminName: string
    loginName: string
    roleCode: string
    roleName: string
    orgCode: string
    orgCodePath: string
    orgNamePath: string
    stat: boolean
} & BaseEntity

export type SysEditView = {
    adminCode: string
    adminName: string
    adminMobile: string
    orgCode: string
    loginPwd: string
    roleCode: string
    authOrgCode: string[]
    stat: boolean
}


class SysAdmin {
    RowKey = "adminCode"
    EDIT = "AdminEdit"
    ADD = "AdminAdd"
    DEL = "AdminDel"
    MAPPING = {AdminEdit: "编辑人员", AdminAdd: "新增人员"}


    selectTablePage(props: HttpParamsProps): Promise<Response> {
        return Http.get("/api/admin/page", props)
    }

    selectById(props: ReqProps<SysEditView>) {
        Http.doGet("/api/admin/find", props)
    }

    doEdit(props: ReqProps<void>) {
        Http.doPost("/api/admin/edit", props)
    }

    delete(props: ReqProps<void>) {
        Http.doPost("/api/admin/delete", props)
    }

}

// eslint-disable-next-line import/no-anonymous-default-export
export default new SysAdmin()